/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package actividad5;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;

/**
 *
 * @author Mañana
 */
public class Actividad5 {

    private static FileReader fileReader;
    static int numero;

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        System.out.println("Caracteres: " + calcularNumeroDeCaracteres());
    }

    private static int calcularNumeroDeCaracteres() {
        try {
            File f = new File("./QUIJOTE.txt");
            FileReader fr = new FileReader(f);
            int i;
            int car = 0;
            while ((i = fr.read()) != -1) { //Se lee Todo 1 a 1
                if ((char) i > 'a' & (char)i<'z' || (char)i>'A' & (char)i<'Z') {
                    car++;
                }
            }
            fr.close();
            return car;

        } catch (Exception e) {
            System.out.println(e);
            return 0;
        }
    }
}
